package com.xinghou.platform.dao.main.impl;

import java.sql.ResultSet;
import java.sql.SQLException;

import javax.annotation.Resource;

import org.springframework.dao.DataAccessException;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.stereotype.Repository;

import com.xinghou.platform.dao.bases.JdbcTemplate;
import com.xinghou.platform.dao.bases.database.CustomerContextHolder;
import com.xinghou.platform.dao.main.ReportInfoDAO;
import com.xinghou.platform.model.main.ReportInfo;
import com.xinghou.platform.model.main.ReportStore;

@Repository
public class ReportInfoDAOImpl  {/*
	@Resource
	private JdbcTemplate jdbcTemplate;
	
	@Override
	public int updateReportInfo(ReportInfo reportInfo)
			throws DataAccessException {
		StringBuffer strSQL = new StringBuffer("UPDATE report_info SET User_id =?,Report_id =?,Report_type =?,Reason_id =?,Description =?,STATUS =?,Create_time =? WHERE Id=?");					
		Object[] params = {reportInfo.getUserId(),reportInfo.getReportId(),reportInfo.getReportType(),reportInfo.getReasonId(),reportInfo.getDescription(),reportInfo.getStatus(),reportInfo.getCreateTime(),reportInfo.getId()};
		CustomerContextHolder.setCustomerType(CustomerContextHolder.DATA_SOURCE_WRITE);
		int ret = jdbcTemplate.update(strSQL.toString(),params);
		CustomerContextHolder.clearCustomerType();
		return ret;
	}

	@Override
	public int saveReportInfo(ReportInfo reportInfo)
			throws DataAccessException {
		StringBuffer strSQL = new StringBuffer("INSERT INTO report_info (User_id,Report_id,Report_type,Reason_id,Description,STATUS,Create_time) VALUES(?,?,?,?,?,?,?);");			
		Object[] params = {reportInfo.getUserId(),reportInfo.getReportId(),reportInfo.getReportType(),reportInfo.getReasonId(),reportInfo.getDescription(),reportInfo.getStatus(),reportInfo.getCreateTime()};
		CustomerContextHolder.setCustomerType(CustomerContextHolder.DATA_SOURCE_WRITE);
		int ret =jdbcTemplate.save(strSQL.toString(),params);
		CustomerContextHolder.clearCustomerType();
		return ret;
	}

	private static final class ReportInfoMapper implements RowMapper<ReportInfo> {
		public ReportInfo mapRow(ResultSet rs, int rowNum) throws SQLException {
			ReportInfo reportInfo = new ReportInfo();
			reportInfo.setCreateTime(rs.getDate("Create_time"));
			reportInfo.setDescription(rs.getString("Description"));
			reportInfo.setId(rs.getInt("Id"));
			reportInfo.setReasonId(rs.getShort("Reason_id"));
			reportInfo.setStatus(rs.getShort("STATUS"));
			reportInfo.setReportType(rs.getInt("Report_type"));
			reportInfo.setReportId(rs.getInt("Report_id"));
			reportInfo.setUserId(rs.getInt("User_id"));
			return reportInfo;
		}
	}*/
}
